package com.candy.candyproductservice.service;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.candy.candycommon.utils.ResultBean;
import com.candy.candyproductservice.dto.EsSearchDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;

@FeignClient(contextId = "question", value = "candy-product", path = "candy-product/question")
public interface QuestionService {

    @PostMapping("getList")
    @SentinelResource(value = "getList", fallback = "handleException")
    ResultBean getList(EsSearchDTO esSearchDTO);

    default public ResultBean handleException(BlockException e) {
        return ResultBean.error("被限流了");
    }

}
